﻿@using System.Linq
@using BusinessClasses
@model List<BusinessClasses.SubCategoryModel>
@{

    ViewBag.Tile = ViewBag.SubCategoryName;
}
<head>
    <title>
        @ViewBag.Tile
    </title>
</head>

<div>
    @if (Model.Count == 0)
{
        <div>
    <img src="~/Content/Images/NoDataImage.png" class="NoDataImg" />
            <h1 class="NoData">Sorry No Content Present under this Category.</h1>
            </div>
}
    else
    {
        foreach (var item in Model)
        {
            <a href='@string.Format("../Home/Details/{0}", item.SubCategoryDataId)' style="text-decoration: none;color:inherit;">
                <div class="ListItemDiv">
                    @{
            int val = 4;
            if (item.Attachments.Any(m => m.FileType == AttachmentType.Video))
            {
                val = 1;
            }
            else if (item.Attachments.Any(m => m.FileType == AttachmentType.Image))
            {
                val = 2;
            }
            else if (item.Attachments.Any(m => m.FileType == AttachmentType.Audio))
            {
                val = 3;
            }
                    }

                    @switch (val)
                    {
                        case 1:
                            <img src="@Url.Content("/Content/Images/VideoImage.png")" class="MediaThumbnail" />
                            break;
                        case 2:
                        <img src="@Url.Content("/Content/Images/UploadedImages/"+item.Attachments.FirstOrDefault(m=>m.FileType==AttachmentType.Image).FileName)" class="MediaThumbnail ImageThumbnail" />
                            break;
                        case 3:
                        <img src="@Url.Content("/Content/Images/AudioImage.png")" class="MediaThumbnail" />
                            break;
                        default:
                        <img src="@Url.Content("/Content/Images/DocumentImage.png")" class="MediaThumbnail" />
                            break;



                    }

                </div>

                <div class="SubCategoryDetailPara">
                    <h1 class="SubCategoryTitle">@item.Title</h1>
                    <p>@(String.Join(" ", (item.Description + "asdasd adad asda adas da d asd a da da d ad ada da d a da d asd a da sd as d asd a d asd as d asd a s d asd as da sd as daas a d asd a da da das d ad asd ad a d a d sdasdasdas  a das da sd as").Split(' ').Take(60)))

                    <p style="font-weight: bold">Read More</p>
                    </p>

                </div>
            </a>
        }
    }
</div>

<link href="~/Content/ViewCss/SubCategoryList.css" rel="stylesheet" />